--------------------------------------------------
-- Level code
-- Created 4:56 2021-3-15
--------------------------------------------------

require("Libraries.nsmbwalls")
local BootsLayer

function onStart()
    BootsLayer = Layer.get("Boots")
    if globalsave.WaterBoots then
        BootsLayer:hide(true)
    end
end

function onTick()
    for key, value in ipairs(NPC.get(97, -1)) do
		if not value.StoredY then
			value.StoredY = value.y
		end
		value.y = value.StoredY
	end
	if Level.winState() == 6 then
		Level.winState(1)
		-- SFX.play(19)
	end
end

function onEvent(eventName)
    if eventName == "boot time" and not globalsave.WaterBoots then
        globalsave.WaterBoots = true
        for _, plyr in ipairs(Player.get()) do
            globalsave["WaterShoesOn" .. plyr.idx] = true
            BootsLayer:hide(false)
        end
    end
end

